import sys
import logging
from datetime import datetime
from stock_a.sample.stock_sample_generator import StockSampleGenerator

if __name__ == '__main__':
    argv_list = sys.argv
    if len(argv_list) < 3:
        logging.error('Please input the start_date and end_date. For example: python sample_daily_executor.py 2020-01-26 2025-01-26')
        sys.exit(-1)
    start_date = datetime.strptime(argv_list[1], '%Y-%m-%d').date()
    end_date = datetime.strptime(argv_list[2], '%Y-%m-%d').date()
    sample_generator = StockSampleGenerator()
    sample_generator.clear_all_data()
    sample_generator.generate_stock_sample(start_date, end_date)